﻿Ext.define('Admin.view.orderapprove.OrderApproveGrid', {
	extend: 'Ext.grid.Panel',
	xtype: 'orderapprove-grid',
	id: 'orderapprove-grid',
	title: '审批列表',		//需要修改
	iconCls: 'x-fa fa-list-alt',
	//cls: 'user-grid', //需要修改
	controller: 'orderapprove',
	viewModel: { type: 'orderapprove' },
	bind: '{orderApproveStore}',//调用组件4
	selModel: {
		selType: 'checkboxmodel',
		//checkOnly: true,
		showHeaderCheckbox: true
	},
	columns: [{
		xtype: 'actioncolumn',
		items: [

			{
				xtype: 'button',
				iconCls: 'x-fa fa-pencil',
				tooltip: "签收",
				getClass: function (v, meta, rec) {
					if (rec.get('assignee') != '') {
						return 'x-hidden';
					}
					return 'x-fa fa-pencil';
				},
				handler: 'onClickOrderApproveClaimButton'	//ajax  taskId
			}, {
				xtype: 'button',
				iconCls: 'x-fa fa-pencil-square-o',
				tooltip: "审批",
				getClass: function (v, meta, rec) {
					if (rec.get('assignee') == '') {
						return 'x-hidden';
					} else if (rec.get('assignee') == rec.get('userName')) {
						return 'x-hidden';
					}
					return 'x-fa fa-pencil-square-o';
				},
				handler: 'onClickOrderApproveCompleteWindowButton'	//taskDefinitionKey 动态表单
			}, {
				xtype: 'button',
				iconCls: 'x-fa fa-pencil-square-o',
				tooltip: "调整申请",
				getClass: function (v, meta, rec) {
					if (rec.get('assignee') != rec.get('userName')) {
						return 'x-hidden';
					}
					return 'x-fa fa-pencil-square-o';
				},
				handler: 'onClickOrderApproveCompleteWindowButton'	//taskDefinitionKey 动态表单
			}, {
				xtype: 'button',
				iconCls: 'x-fa fa-arrow-circle-up',
				tooltip: "重新上传",
				getClass: function (v, meta, rec) {
					if (rec.get('assignee') != rec.get('userName')) {
						return 'x-hidden';
					}
					return 'x-fa fa-arrow-circle-up';
				},
				handler: 'onClickOrderReapplyButton'	//taskDefinitionKey 动态表单
			}, {
				xtype: 'button',
				iconCls: 'x-fa fa-close',
				tooltip: "取消申请",
				getClass: function (v, meta, rec) {
					if (rec.get('assignee') != rec.get('userName')) {
						return 'x-hidden';
					}
					return 'x-fa fa-close';
				},
				handler: 'onClickOrderCancelButton'	//taskDefinitionKey 动态表单
			}

		],
		cls: 'content-column',
		width: 70,
		dataIndex: 'bool',
		text: '操作',
		tooltip: 'edit '
	}
		//业务字段
		, { header: '订单编号', dataIndex: 'orderId', width: 80, sortable: true, hidden: true }
		, { header: '申请人', dataIndex: 'userName', width: 80, sortable: true }
		, { header: '部门', dataIndex: 'departmentName', width: 60, sortable: true }
		, { header: '晚餐', dataIndex: 'dinner', width: 50, sortable: true }
		, { header: '宵夜', dataIndex: 'nightSnack', width: 50, sortable: true }
		, { header: '次日早餐', dataIndex: 'breakfast', width: 75, sortable: true }
		, { header: '次日午餐', dataIndex: 'lunch', width: 75, sortable: true }
		, { header: '申请时间', dataIndex: 'applyTime', width: 145, sortable: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') }
		, { header: '状态', dataIndex: 'state', width: 60, sortable: true }
		, { header: '审批人', dataIndex: 'approver', width: 180, sortable: true }
		, { header: '审批时间', dataIndex: 'approvalTime', width: 145, sortable: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') }
		//,{header: '驳回原因'  		,dataIndex: 'refuseReason',width: 80,sortable: true}
		, {
		xtype: 'actioncolumn',
		items: [{
			xtype: 'button',
			iconCls: 'x-fa fa-eye',
			tooltip: "查看",
			handler: 'onClickBackReasonButton'	//taskDefinitionKey 动态表单
		}
		],
		cls: 'content-column',
		width: 105,
		dataIndex: 'bool',
		text: '驳回原因'
	}
		//流程字段
		, { header: 'processInstanceId', dataIndex: 'processInstanceId', width: 80, sortable: true, hidden: true }
		, { header: 'taskId', dataIndex: 'taskId', width: 60, sortable: true, hidden: true }
		, { header: 'taskName', dataIndex: 'taskName', width: 80, sortable: true, hidden: true }
		, { header: 'taskCreateTime', dataIndex: 'taskCreateTime', width: 145, sortable: true, hidden: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') }
		, { header: 'assignee', dataIndex: 'assignee', width: 80, sortable: true, hidden: true }
		, { header: 'taskDefinitionKey', dataIndex: 'taskDefinitionKey', width: 80, sortable: true, hidden: true }
		, { header: 'processDefinitionId', dataIndex: 'processDefinitionId', width: 80, sortable: true, hidden: true }
		, { header: 'suspended', dataIndex: 'suspended', width: 80, sortable: true, hidden: true }
		, { header: 'version', dataIndex: 'version', width: 60, sortable: true, hidden: true }
	],
	dockedItems: [{
		xtype: 'pagingtoolbar',
		dock: 'bottom',
		bind: '{orderApproveStore}',	//调用组件4
		displayInfo: true,
		displayMsg: '显示第 {0} - {1} 条数据 总计 {2}',
		emptyMsg: "没有任何数据"
	}]
});